package com.dycx.user.dto;

import com.dycx.common.ValidationGroup;
import com.dycx.common.constants.RegexpConstants;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;


@EqualsAndHashCode(callSuper = true)
@Data
public class UserDTO extends UserInfoDTO implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    private Integer uid;

    /**
     * 用户名
     */
    @NotBlank(message = "登录用户名不能为空", groups = {
            ValidationGroup.PasswordLogin.class
    })
    @Length(min = 2, max = 20, message = "登录用户名长度为2-20位", groups = {
            ValidationGroup.PasswordLogin.class
    })
    private String username;

    /**
     * 密码
     */
    @NotBlank(message = "登录用户名不能为空", groups = {
            ValidationGroup.Insert.class,
            ValidationGroup.PasswordLogin.class,
            ValidationGroup.UpdatePassword.class
    })
    @Length(min = 2, max = 20, message = "密码长长度为2-20位", groups = {
            ValidationGroup.Insert.class,
            ValidationGroup.PasswordLogin.class,
            ValidationGroup.UpdatePassword.class
    })
    private String password;

    /**
     * 手机号
     */
    @NotBlank(message = "手机号码不能为空", groups = {
            ValidationGroup.Insert.class,
            ValidationGroup.MobileCode.class
    })
    @Length(min = 11, max = 11, message = "手机号只能为11位", groups = {
            ValidationGroup.Insert.class,
            ValidationGroup.MobileCode.class
    })
    @Pattern(regexp = RegexpConstants.MOBILE, message = "手机号格式有误", groups = {
            ValidationGroup.Insert.class,
    })
    private String mobile;

    /**
     * 姓名
     */
    private String realName;

    /**
     * 身份证号
     */
    private String idCard;


    private String wxUnionid;

    private String wxMpOpenId;

    private String wxMiniOpenId;

    private String wxAppOpenId;

    /**
     * 分享人uid
     */
    private Integer shareUid;

    /**
     * 会员类型
     */
    private Integer vipType;

    /**
     * 会员过期时间
     */
    private LocalDateTime vipExpiredTime;

    /**
     * 会员等级
     */
    private Integer vipGrade;

    /**
     * 代理等级
     */
    private Integer agencyGrade;

    /**
     * 状态
     */
    private Boolean status;



    /**
     * 验证码
     */
    @NotBlank(message = "验证码不能为空", groups = {
            ValidationGroup.Insert.class,
            ValidationGroup.MobileCode.class
    })
    @Length(min = 4, max = 4, message = "验证码长度不正确", groups = {
            ValidationGroup.Insert.class,
            ValidationGroup.MobileCode.class
    })
    private String code;

    private String queryType;


}
